Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glob/fsWalk: early exclusion of non-matching directories #1251

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

Blugatroff
Copy link
Contributor

@Blugatroff Blugatroff commented Jul 9, 2024

Description of the change

For glob patterns with a fixed prefix, fsWalk will now no longer traverse directories whose contents obviously cannot match, because the directory path doesn't match the fixed prefix of the pattern.

For example, previously, globbing for .spago/p/tailrec-6.1.0/**/*.purs would traverse every directory (apart from those in a .gitignore, although in the case of globbing for something in .spago, that's not of much help).
Now only directories whose relative path starts with .spago/p/tailrec-6.1.0 would be recursed into.

To determine the longest fixed prefix of a glob pattern, i used the scan function from picomatch, which is already a dependency of micromatch.

Fix #1243 as per #1243 (comment)

Checklist:

  • Added the change to the "Unreleased" section of the changelog
  • Added a test for the contribution (if applicable)

P.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 😊

Copy link
Member

@f-f f-f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent patch @Blugatroff ❤️

With this the running time on the purescript-core repo goes from 30s to less than 5s, which is way nicer.

I left a small note about npm dependencies, but otherwise this is good to merge

src/Spago/Glob.js Show resolved Hide resolved
@f-f f-f merged commit bebd037 into purescript:master Jul 11, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stuck at purs graph
2 participants